package com.fqxl.labour.controller;

import com.fqxl.labour.domain.LabourJob;
import com.fqxl.labour.domain.vo.PageVo;
import com.fqxl.labour.service.JobService;
import com.fqxl.labour.untils.R;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("/Job")
@Api(tags = "招聘、求职信息")
public class JobController {

    @Autowired
    private JobService jobService;

    /**
     * 发布招工信息
     * @param labourJob
     * @return
     */
    @ApiOperation("发布招工信息")
    @PostMapping("/addJob")
    public R addJob(@RequestBody LabourJob labourJob){
        return jobService.addJob(labourJob);
    }

    /**
     * 查询招工信息列表
     * @param pageVo
     * @return
     */
    @ApiOperation("查询发布招工信息")
    @PostMapping("/selectJob")
    public R selectJob(@RequestBody PageVo pageVo){
        return jobService.selectJob(pageVo);
    }

    /**
     * 根据id查询招工详情
     * @param id
     * @return
     */
    @ApiOperation("根据id查询招工详情")
    @PostMapping("/getJobById/{id}")
    public R getJobById(@PathVariable String id){
        return jobService.getJobById(id);
    }

    /**
     * 发布求职信息
     * @param labourJob
     * @return
     */
    @ApiOperation("发布求职信息")
    @PostMapping("addJobs")
    public R addJobs(@RequestBody LabourJob labourJob){
        return jobService.addJobs(labourJob);
    }

    /**
     * 查询发布求职信息
     * @param pageVo
     * @return
     */
    @ApiOperation("查询发布求职信息")
    @PostMapping("/selectJobs")
    public R selectJobs(@RequestBody PageVo pageVo){
        return jobService.selectJobs(pageVo);
    }

    /**
     * 根据id查询求职详情
     * @param id
     * @return
     */
    @ApiOperation("根据id查询求职详情")
    @PostMapping("getSelectByIds/{id}")
    public R getSelectByIds(@PathVariable String id){
        return jobService.getSelectByIds(id);
    }

    /**
     * 我发布的信息
     * @param pageVo
     * @return
     */
    @ApiOperation("我发布的信息")
    @PostMapping("selectUserId")
    public R selectUserId(@RequestBody PageVo pageVo){
        return jobService.selectUserId(pageVo);
    }

}
